package com.adtech.farmProducts.activities.activity.procurement;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.adtech.farmProducts.R;
import com.adtech.farmProducts.base.BaseNfcActivity;
import com.gyf.barlibrary.ImmersionBar;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Time:2020/6/30
 * Created by xiaocz
 * Describe 集中采购
 */
public class ProcurementActivity extends BaseNfcActivity {

    @BindView(R.id.btn_ok)
    Button btn_ok;
    @BindView(R.id.btn_right)
    TextView btn_right;

    private int position;

    public static void show(Context context,int position) {
        Intent intent = new Intent(context, ProcurementActivity.class);
        intent.putExtra("position",position);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutSourceId() {
        return R.layout.activity_procurement;
    }

    @Override
    protected boolean initArgs(Bundle bundle) {
        if(bundle!=null){
            position=bundle.getInt("position");
        }
        return super.initArgs(bundle);
    }

    @Override
    protected void initData() {
        super.initData();
        //btn_right.setVisibility(View.VISIBLE);
        if(position==0){
            btn_ok.setText("集中采购");
            btn_right.setText("采购历史");
        }else {
            btn_ok.setText("扫码上架");
            btn_right.setText("上架历史");
        }
    }

    @OnClick({R.id.btn_right,R.id.btn_ok})
    public void onClick(View view){
        switch (view.getId()){
            case R.id.btn_right:
                break;
            case R.id.btn_ok:
                if (position == 0) {
                    Procurement2Activity.show(mContext);//集中采购
                } else {
                    ScanCodePutAwayActivity.show(mContext);//扫码上架
                }
                finish();
                break;
        }
    }
}
